<template>
	<view class="page-index" style="background: #1a2a7e;min-height: 100vh;">
		
		
		
		<view class="">
			<swiper class="swiper" style="height:500rpx" circular @change="bannerChange">
				<swiper-item @click="toBanner(item)" v-for="(item,index) in bannerList" :key="index">
					<image :src="$wanlshop.oss(item.image)" style="width: 100%;height:500rpx;display: block;"></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="pl12 pr12" style="position: relative;top: -70rpx;">
			
			<view class="brs8 p15 pt10 pb10 bg-white bg-shaw">
				<view class="u-f-item u-f-jsb" v-if="user.isLogin" @click="toPage('/pages/user/setting/user')">
					<view class="u-f-item">
						<u-avatar size="100" :src="user.avatar"></u-avatar>
						<view class="pl8">
							<view class="fz16 u-font-bold">{{user.nickname}}</view>
				
				
							<view class="mt5 u-f-item">
								<view class="fz12 c9">开启尊享权益</view>
							</view>
						</view>
					</view>
					<view class="u-flex">
						<u-icon class="fz16" name="arrow-right" color="#666"></u-icon>
					</view>
				</view>
				<view class="u-f-item u-f-jsb" v-else @click="toPage('/pages/user/auth/auth')">
					<view class="u-f-item">
						<u-avatar size="100"></u-avatar>
						<view class="u-p-l-20">
							<view class="fz16">登录/注册</view>
							<view class="mt5 u-f-item">
								<view class="fz12">欢迎来到您的360°视健康管理中心</view>
							</view>
						</view>
						
					</view>
					<u-icon name="arrow-right" color="#D9D9D9"></u-icon>
				</view>
			</view>
			
			
			<view class="brs8 p12 bg-white bg-shaw u-flex u-f-jsb mt12 pl20 pr20" style="text-align: center;">
				<view class=""  @click="toPage('/pages/product/list?pageType=gift')" v-if="showValue==1">
					<image src="/static/images/fl.png" style="width: 80rpx;height: 80rpx;"></image>
					<view class="fz12 mt3">福利领用</view>
					<view class="c9 mt2" style="font-size: 20rpx;">折扣、现金、赠品</view>
				</view>
				<view class=""  @click="toPage('/pages/product/list')" v-if="showValue==1">
					<image src="/static/images/ic-2.png" style="width: 80rpx;height: 80rpx;"></image>
					<view class="fz12 mt3">会员商城</view>
					<view class="c9 mt2" style="font-size: 20rpx;">会员礼品换购</view>
				</view>
				<view class="" @click="toSwith('/pages/store/add')">
					<image src="/static/images/ic-ya.png" style="width:80rpx;height: 80rpx;"></image>
					<view class="fz12 mt3">预约</view>
					<view class="c9 mt2" style="font-size: 20rpx;">门诊医生预约</view>
				</view>
			</view>
			<view class="brs8 bg-white bg-shaw u-flex u-f-jsb mt12" style="text-align: center;flex-wrap: wrap;">
				<view @click="toSwith('/pages/store')" class="p15" style="width: 50%;border-bottom: 1px solid #f5f5f5;border-right: 1px solid #f5f5f5">
					<image src="/static/images/ic-1.png" style="width: 100rpx;height: 100rpx;"></image>
					<view class="fz14 mt3">线下门店</view>
				</view>
				<view @click="toTips" v-if="showValue==1" class="p15" style="width: 50%;border-bottom: 1px solid #f5f5f5;">
					<image src="/static/images/ic-2.png" style="width: 100rpx;height: 100rpx;"></image>
					<view class="fz14 mt3">云商城</view>
				</view>
				<view @click="toTips" v-if="showValue==1" class="p15" style="width: 50%;border-right: 1px solid #f5f5f5">
					<image src="/static/images/ic-4.png" style="width: 100rpx;height: 100rpx;"></image>
					<view class="fz14 mt3">合作渠道</view>
				</view>
				
				<view class="p15" style="width: 50%;" @click="toPage('/pages/article/list?type=hospital')">
					<image src="/static/images/ic-3.png" style="width: 100rpx;height: 100rpx;"></image>
					<view class="fz14 mt3"> 牙科知识</view>
					
				</view>
			</view>
			
			<!-- <view class="mt12">
				<swiper class="swiper" style="height:240rpx" circular @change="bannerChange">
					<swiper-item @click="toBanner(item)" v-for="(item,index) in 3" :key="index">
						<image src="/static/images/banner1.png" style="width: 100%;height:240rpx;display: block;border-radius: 10rpx;"></image>
					</swiper-item>
				</swiper>
			</view> -->
		</view>
		
		


		
	</view>
</template>

<script>
import { mapState } from 'vuex';
	export default {
		data() {
			return {
				keyword: '',
				isLogin:false,
				search: {},
				curArticle:1,
				noticeList: [],
				serviceImg: '',
				showVideo: false,
				showService: false,
				showTips: false,
				// 选择
				statusBarHeight: 20,
				curBanner: {},
				bannerHeight: 200,
				background: {
					background: '#1a2a7e'
				},
				showValue:0,
				userInfo: {},
				otherList: [],
				flowList: [],
				loadStatus: 'loadmore',
				page: 1,
				noticeListAll: [],
				actionList: [],
				bannerList: [],
			}
		},
		onShareAppMessage(e) {},
		onShareTimeline() {

		},
	computed: {
		...mapState(['user'])
	},
		onShow() {
			
			
				uni.request({
					url: '/wanlshop/index/show',
					complete: res => {
						console.log(res,1212)
						if(res.res.code === 1){
							this.showValue=res.res.data
						}
					}
				});
				if (this.$store.state.user.isLogin) {
					this.getMember();
				}
		},
		onLoad(e) {
			this.$nextTick(() => {
				this.initData()


				

			})
		},
		methods: {
			toTips(){
				uni.showToast({
					title:'功能待开放',
					icon:'none'
				})
			},
			toSwith(url){
				uni.switchTab({
					url
				})
			},
			toPage(url){
				uni.navigateTo({
					url
				})
			},
			
			getMember(){
				
			},
			initData() {

				uni.request({
					url: '/wanlshop/index/banner',
					complete: res => {
						console.log(res,1212)
						if(res.res.code === 1){
							this.bannerList=res.res.data
						}
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.act-img {
		width: 382rpx;
		height: 188rpx;
		display: block;
	}
	.search-select{
		background: #fff;
		border-radius: 50rpx;
		padding: 12rpx 18rpx;
		width: 150rpx;
	}
	page {}
	.page-content{
		background: #fff;
		border-radius: 30rpx;
		position: relative;
		top: -30rpx;
	}
	.ic-play {
		background: rgba(0, 0, 0, 0.2);
		border-radius: 20rpx;
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;

	}

	.module-banner {
		height: 280rpx;


	}

	.module-activity {
	}

	// .index-act{
	// 	.act1{
	// 		height: 188rpx;
	// 		background:url('https://dl.nhbdic.com/admin-api/infra/file/18/get/image/bg-act1.png');
	// 		background-size: cover;
	// 	}
	// 	.act2{
	// 		height: 188rpx;
	// 		background:url('https://dl.nhbdic.com/admin-api/infra/file/18/get/image/bg-act.png');
	// 		background-size: cover;
	// 	}
	// }
	.bg-img-block{
		background: #1a2a7e;
		height: 500rpx;
	}
	.module-user{
		padding-bottom: 50rpx;
		background: #1a2a7e;
	}
	.btn-view{
		background: #1a2a7e;
		color: #fff;
		border-radius: 50rpx;
		padding: 10rpx 20rpx;
		
	}
</style>